package com.zhuoyue.web.controller.system;

import com.zhuoyue.common.core.controller.BaseController;
import com.zhuoyue.common.core.domain.AjaxResult;
import com.zhuoyue.common.core.page.TableDataInfo;
import com.zhuoyue.common.utils.poi.ExcelUtil;
import com.zhuoyue.system.domain.po.FingerPrintPo;
import com.zhuoyue.system.domain.vo.FingerPrintVo;
import com.zhuoyue.system.service.ITblFingerPrintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhanghui
 * @date 2021/9/24 15:21
 */
@RestController
@RequestMapping("/system/fingerPrint")
public class FingerPrintController extends BaseController {
    @Autowired
    private ITblFingerPrintService fingerPrintService;

    @GetMapping("/list")
    public TableDataInfo list(FingerPrintPo fingerPrintPo) {
        startPage();
        List<FingerPrintVo> list = fingerPrintService.listFingerPrint(fingerPrintPo);
        return getDataTable(list);
    }

    @GetMapping("/export")
    public AjaxResult export(FingerPrintPo fingerPrintPo) {
        List<FingerPrintVo> list = fingerPrintService.listFingerPrint(fingerPrintPo);
        ExcelUtil<FingerPrintVo> util = new ExcelUtil<>(FingerPrintVo.class);
        return util.exportExcel(list, "指纹信息");
    }

    @DeleteMapping("/delete")
    public AjaxResult remove(String id) {
        fingerPrintService.deleteFingerPrint(id);
        return AjaxResult.success();
    }
}
